package com.ribbon.impl;

import com.netflix.loadbalancer.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MyRule {
    @Bean
    public IRule getIRule(){
        IRule rule=
                //默认规则
                //new ZoneAvoidanceRule();
                //过滤掉失败的
                //new AvailabilityFilteringRule();
//                优先
                new BestAvailableRule();
//                权重
//                WeightedResponseTimeRule
                //重试
//                new RetryRule();
                //轮询
//                new RoundRobinRule();
                //随机
//                new RandomRule();
        return rule;
    }

}